<!DOCTYPE html>
<html>

<head lang="en">
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<title>用友审计-招投标信息监控系统</title>
	<link rel="stylesheet" href="static/css/bootstrap.min.css" />
	<link rel="stylesheet" href="static/css/bootstrap-theme.min.css" />
	<link rel="stylesheet" href="static/css/bootstrap-table.min.css" />
</head>

<body>
	<div class="container">
		<div id="toolbar" class="fixed-table-toolbar">
			<h2>用友审计-监控信息邮件自动发送配置</h2>
		</div>
		<div style="float: right;"><a href="./logout">注销</a></div>
		{% if (!curr) %}
		<div style="margin-top:15px;">
			<table id="table" data-toggle="table" data-click-to-select="true" data-row-style="rowStyle" data-height="400" style="word-break:break-all; word-wrap:break-all;">
				<thead>
					<tr>
						<th>ID</th>
						<th>邮件主题</th>
						<th>监控标题（支持 AND/OR 优先级运算符）</th>
						<th>
							<div style="text-align: center;">接收邮件地址（,分割）</div>
						</th>
						<th>
						  <div style="text-align: center;">操作</div>	
						</th>
					</tr>
				</thead>
				{% for item in items %}
				<tr>
					<td>{{item.id}}</td>
					<td>{{item.tip}}
					<td>{{item.keywords}}
					</td>
					<td>{{item.emails}}</td>
					<td>
						<div style="width: 115px;white-space: nowrap;">
							<form style="display: inline-block;" action="./editMail" method="post"><input type="hidden" name="id" value="{{item.id}}"></input><input type="submit" class="btn btn-info" value="编辑"></input>
							</form>
							<form style="display: inline-block;" action="./delMail" method="post" id="frm_{{item.id}}"><input type="hidden" name="id" value="{{item.id}}"></input><input type="button" class="btn btn-danger" onclick="deleteThis({{item.id}})"
									value="删除"></input>
							</form>
						</div> 
						
					</td>
				</tr>
				{% endfor %}
			</table>
		</div>
		{% endif %}
		<div>
			{% if (curr) %}
			<h3>编辑邮件自动发送配置</h3>
			<form action="./updateMail" method="post">
				<input name="id" value="{{curr.id}}" type="hidden" style="margin-bottom:10px;"/>
				<input name="tip" value="{{curr.tip}}" class="form-control" style="margin-bottom:10px;"/>
				<input name="keywords" value="{{curr.keywords}}" class="form-control" style="margin-bottom:10px;"/>
				<input name="emails" value="{{curr.emails}}" class="form-control" style="margin-bottom:10px;"/>
				<input type="submit" value="更新" class="btn btn-primary" style="float: right;"/>
			</form>
			{% else %}
			<h3>新增邮件自动发送配置</h3>
			<form action="./addMail" method="post" id="add_post">
				<input name="tip" placeholder="请输入邮件主题词" class="form-control" style="margin-bottom:10px;"/>
				<input name="keywords" placeholder="请输入监控的关键词" class="form-control" style="margin-bottom:10px;"/>
				<input name="emails" placeholder="请输入通知的emails" class="form-control" style="margin-bottom:10px;"/>
				<input type="submit" value="保存" class="btn btn-primary" style="float: right;"/>
			</form>
			{% endif %}
		</div>
	</div>
	<div style="width: 200px;margin: 0 auto;">&copy;用友审计 2016</div>
	<div style="float: right;"><a href="https://git.oschina.net/sunnytu/crawler4zb" target="_blank">Source Code</a>&nbsp;&nbsp;<a href="./index">首页</a></div>
	<script src="static/js/jquery-2.1.3.min.js"></script>
	<script src="static/js/bootstrap.min.js"></script>
	<script src="static/js/bootstrap-table.min.js"></script>
	<script src="static/js/bootstrap-table-zh-CN.min.js"></script> {% if (!curr) %}
	<script>
		function deleteThis(id){
			console.log(id);
			if (!confirm("您真的要删除当前配置项吗？")) return;
			$("#frm_" + id).submit();
		};
    </script> {% endif %}
</body>

</html>
